package com.autoplaza;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.widget.Button;

public class SplashPublicidad extends Activity {
	String content,sb9,issearch;
	WebView myWebView;
	Button omitir;
	int var = 0;
	protected void  hiloCambiarVista() {
        Thread t = new Thread() {
            @Override
			public void run() {
                try {
                    Thread.sleep(5000);
                    if(var == 0){
//                    	Intent intent = new Intent();
//                        intent.setClass(SplashPublicidad.this, Resultados.class);
//                        intent.putExtra("content", ""+content);
//    					Log.i("ESTA ES LA BUENA", ""+sb9);
//    					intent.putExtra("sb9", ""+sb9);
//    					intent.putExtra("issearch", "true");
//                        startActivity(intent);
                        finish();
                    }
                    
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        t.start();
        
    }
	
    
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    }
	

    
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splashpublicidad);
        
        myWebView = (WebView)this.findViewById(R.id.webview);
        myWebView.getSettings().setJavaScriptEnabled(true);
        myWebView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
        myWebView.loadUrl("http://iphone.autoplaza.com.mx/BannersAndroid/Banners.aspx?splash=yes");
        
        omitir = (Button) findViewById(R.id.btn_omitir);
        omitir.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
        hiloCambiarVista();

//        Bundle extras=getIntent().getExtras();
//        if(extras != null){
//        	content=extras.getString("content");
//        	sb9=extras.getString("sb9");
//        	issearch=extras.getString("issearch");
//            hiloCambiarVista();
//
//        }
        
    }
}
